package com.sss.hloster04;
import java.util.Scanner;
public class JavaExercise14 {

	public static void main(String[] args) {
		
		test14();
	}
/**题   14：
 * 输入某年某月某日，判断这一天是这一年的第几天
 */
	private static void test14() {
		Scanner sc =new Scanner(System.in);
		System.out.print("输入年份：");
		int year =sc.nextInt();
		System.out.print("输入月份：");
		int month = sc.nextInt();
		System.out.print("输入日期：");
		int day = sc.nextInt();
		//判断是否是闰年
		boolean y=false;
		if(year%400 ==0 &&  year%4 ==0  && year%100 !=0) {//判断是否是闰年
			y=true;
		}
		int ap =y?29:28;//二月份
		int num=0;
		switch(month) {
		case 1:
			num=day;
			break;
		case 2:
			num =31+day;
			break;
		case 3:
			num =31+ap+day;
			break;
		case 4:
			num =31+ap+31+day;
			break;
		case 5:
			num =31+ap+31+30+day;
			break;
		case 6:
			num =31+ap+31+30+31+day;
			break;
		case 7:
			num =31+ap+31+30+31+30+day;
			break;
		case 8:
			num =31+ap+31+30+31+30+31+day;
			break;
		case 9:
			num =31+ap+31+30+31+30+31+31+day;
			break;
		case 10:
			num =31+ap+31+30+31+30+31+31+30+day;
			break;
		case 11:
			num =31+ap+31+30+31+30+31+31+30+31+day;
			break;
		case 12:
			num =31+ap+31+30+31+30+31+31+30+31+30+day;
			break;
			default:
				System.out.println("输入错误！！");
				break;
		}
		System.out.println("这一天是这一年的第"+num+"天!!!");
	}
}
